/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modeles;

import modeles.Commande;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author MAZID
 */
@Entity
public class Client implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "loginCl")
    private String loginCl;
    private String mdpCl;
    private String nomCl;
    private String pnomCl;
    private String adresse;
    private String cp;
    private String ville;
    private String pays;
    private String tel;
    private String email;
    
//    @OneToMany(mappedBy = "client", fetch = FetchType.EAGER)
//    private Collection<Commande> commandes;

    public Client() {
        
    }

    public Client(String loginCl) {
        this.loginCl = loginCl;
    }

    public Client(String loginCl, String mdpCl, String nomCl, String pnomCl, String adresse, 
                    String cp, String ville, String pays, String tel, String email) {
        this.loginCl = loginCl;
        this.mdpCl = mdpCl;
        this.nomCl = nomCl;
        this.pnomCl = pnomCl;
        this.adresse = adresse;
        this.cp = cp;
        this.ville = ville;
        this.pays = pays;
        this.tel = tel;
        this.email = email;
    }

    public String getLoginCl() {
        return loginCl;
    }

    public void setLoginCl(String loginCl) {
        this.loginCl = loginCl;
    }

    public String getMdpCl() {
        return mdpCl;
    }

    public void setMdpCl(String mdpCl) {
        this.mdpCl = mdpCl;
    }

    public String getNomCl() {
        return nomCl;
    }

    public void setNomCl(String nomCl) {
        this.nomCl = nomCl;
    }

    public String getPnomCl() {
        return pnomCl;
    }

    public void setPnomCl(String pnomCl) {
        this.pnomCl = pnomCl;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public String getCp() {
        return cp;
    }

    public void setCp(String cp) {
        this.cp = cp;
    }

    public String getVille() {
        return ville;
    }

    public void setVille(String ville) {
        this.ville = ville;
    }

    public String getPays() {
        return pays;
    }

    public void setPays(String pays) {
        this.pays = pays;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (loginCl != null ? loginCl.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Client)) {
            return false;
        }
        Client other = (Client) object;
        if ((this.loginCl == null && other.loginCl != null) || (this.loginCl != null && !this.loginCl.equals(other.loginCl))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "client.modeles.entity.Client[ loginCl=" + loginCl + " ]";
    }

//    @XmlTransient
//    public Collection<Commande> getCommandes() {
//        return commandes;
//    }
//
//    public void setCommandes(Collection<Commande> commandes) {
//        this.commandes = commandes;
//    }
    
}
